package guru.mercurio.core.delivery;


class routeri{					

boolean invalido = false;


	routeri(){
    
	}
}
    /*
}
					if ((message.equals(""))||(message.indexOf("%")!=-1)||(message.indexOf("&")!=-1)||(message.indexOf("#")!=-1)||(message.indexOf("(")!=-1)||(message.indexOf(")")!=-1)||(message.indexOf("!")!=-1)||(message.indexOf("/")!=-1)||(message.indexOf("=")!=-1)||(message.indexOf("[")!=-1)||(message.indexOf("]")!=-1)||(message.indexOf("+")!=-1)||(message.indexOf("{")!=-1)||(message.indexOf("}")!=-1)||(message.indexOf((char)34)!=-1))
						invalido = true;
						
					if (recNumber.length()>3)
						if (recNumber.substring(0,3).equals("105"))
							recNumber = recNumber.substring(3);

					numero = proccessNumber(number);

					Set passports = bridge.getPassport(Integer.parseInt(recNumber));

					System.out.println(passports.size());

					switch (Integer.parseInt(recNumber)){
						case 22625:
						case 9853:
							numero = proccessNumber(number);
							logicalPort(58, area, numero, message, recNumber, passports, bridge);
							break;
						default:
							Vector passportV = new Vector((Collection)passports);
							
							if (passportV.isEmpty()){
								//Hay que decidir que hacer cuando no hay pasaporte para ese numero
							}								
							else{
								Passport passport = (Passport)passportV.elementAt(0);
							        if (invalido){
									invokeCgi("http://mercurio.twindivision.com/respuesta/invalido.php", "clave", 58, area, numero, "", recNumber, passport.getPasaporte(), passport.getPassword().getPassword(), bridge);
								}
								else{
									enviar(passport.getReceptorUri(),passport.getReceptorPassword(), 58, area, numero, message, recNumber, passport.getPasaporte(), passport.getPassword().getPassword(), bridge);
								}
							}
					}
						
					}




	public static void logicalPort(int pais, int area, int numero, String message, String idMensaje, Set passports, BDBridge bridge) throws Exception{
		String port = new String("");
		String realMessage = new String("");
 		String urlEnv = new String("");
		String pasaporte = new String("");

		if (!(message.indexOf(" ")==-1)){
			port = message.substring(0,message.indexOf(" "));
			realMessage = message.substring(message.indexOf(" ")+1);
		}
		else{
			port = message;
			realMessage = "";
		}

		
		Passport passport = new Passport();
		Passport temp = new Passport();
		Vector passportV = new Vector((Collection)passports);


		for(int i=0;i<passportV.size();i++){
			temp = (Passport)passportV.elementAt(i);
			SubChannel subChannel = new SubChannel();
			boolean def = false;
			if (temp.getDef().getClass()==SubChannel.class)
				subChannel = (SubChannel)temp.getDef();


			
			if ((subChannel.getId())!=0){
				if (subChannel.getSubChannelId().equalsIgnoreCase(port)){
					passport = temp;
					i = passportV.size();
					def = true;
				}
			}
			
			if (!(def)){
				Vector pipes = new Vector((Collection)temp.getPipe());
				for(int j=0;j<pipes.size();j++){
					if (pipes.elementAt(j).getClass()==SubChannel.class){
						subChannel = (SubChannel)pipes.elementAt(j);
						if (subChannel.getSubChannelId().equalsIgnoreCase(port)){
							passport = temp;
							i = passportV.size();
							j = pipes.size();
						}
					}
				}
			}
		}

		if (passport.getId()==0){
			urlEnv = new String("http://mercurio.twindivision.com/respuesta/fallofisico.php");
			pasaporte = "demo4";
		}
		else
			enviar(passport.getReceptorUri(),passport.getReceptorPassword(), pais, area, numero, realMessage, idMensaje, passport.getPasaporte(), passport.getPassword().getPassword(), bridge);
	}



	public static void enviar(String url, String clave, int codPaisRem, int codAreaRem, int numRem, String mensaje, String idMensaje, String pasaporte, String password, BDBridge bridge) throws Exception{
		try{
			invokeCgi(url, clave, codPaisRem, codAreaRem, numRem, mensaje, idMensaje, pasaporte, password, bridge);
		}
		catch(Exception e){
			webServiceInvoke(url, clave, codPaisRem, codAreaRem, numRem, mensaje, idMensaje, pasaporte, password, bridge);
		}
	}


	public static void responder(String pasaporte, String password, int pais, int area, int numero, String respuesta, String idMensaje) throws Exception{
		int st = 0;
		
		if (!(respuesta.equals("null"))){
			Mercurio merc = MercurioHelper.bind("http://localhost:8081/merlin/mercurio.wsdl");
			st = merc.responderSMS(pasaporte,password,""+pais,""+area,""+numero,respuesta,idMensaje);
		}
		if (st==0)
			Log.println(1,"Se ha respondido el mensaje");
		else
			Log.println(1,"No se respondio el mensaje por error: "+st);
	}
*/

